package com.eqs.enterprisequestionnaire.model.enums;

import java.io.File;
import java.util.logging.Level;

public enum QuestionEnum {
    SINGLE_CHOICE("Singlechoice"),
    MULTIPLE_CHOICE("Multiplechoice"),
    SHORT_ANSWER("Shortanswer"),
    DROPDOWN("Dropdown"),
    TEXTAREA("Textarea"),
    SORTQUESTION("Sortquestion"),
    LEVELQUESTION("Levelquestion"),
    FILEQUESTION("filequestion");

    private final String type;

    QuestionEnum(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }
    public static QuestionEnum fromType(String type) {
        for (QuestionEnum questionEnum : QuestionEnum.values()) {
            if (questionEnum.getType().equalsIgnoreCase(type)) {
                return questionEnum;
            }
        }
        throw new IllegalArgumentException("Unknown type: " + type);
    }
    public static boolean isTextType(String type) {
        // 定义文本类型问题的枚举值
        return SHORT_ANSWER.getType().equalsIgnoreCase(type) ||
                TEXTAREA.getType().equalsIgnoreCase(type);
    }
    public static boolean isChoiceType(String type) {
        // 定义选择类型问题的枚举值
        return SINGLE_CHOICE.getType().equalsIgnoreCase(type) ||
                MULTIPLE_CHOICE.getType().equalsIgnoreCase(type) ||
                DROPDOWN.getType().equalsIgnoreCase(type);
    }
    public static boolean isSortType(String type) {
        // 定义排序类型问题的枚举值
        return SORTQUESTION.getType().equalsIgnoreCase(type);
    }
    public static boolean isLevelType(String type) {
        // 定义程度类型问题的枚举值
        return LEVELQUESTION.getType().equalsIgnoreCase(type);
    }
    public static boolean isFileType(String type) {
        // 定义文件类型问题的枚举值
        return FILEQUESTION.getType().equalsIgnoreCase(type);
    }

}
